﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Zt.QmtqDemo.Migrations
{
    public partial class aaa : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "TPOPL001",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    ExtraProperties = table.Column<string>(nullable: true),
                    ConcurrencyStamp = table.Column<string>(nullable: true),
                    ConfmPlanNo = table.Column<string>(maxLength: 255, nullable: false),
                    ConfmStatus = table.Column<string>(maxLength: 100, nullable: false),
                    TotalMatNum = table.Column<int>(nullable: false),
                    TotalMatWt = table.Column<decimal>(nullable: false),
                    OrderNO = table.Column<string>(maxLength: 100, nullable: false),
                    MoveInStockNO = table.Column<string>(maxLength: 10, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TPOPL001", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TPOPL002",
                columns: table => new
                {
                    ConfmPlanId = table.Column<Guid>(nullable: false),
                    MatNo = table.Column<string>(nullable: false),
                    ConfmPlanNo = table.Column<string>(nullable: true),
                    MatThick = table.Column<decimal>(nullable: false),
                    MatWidth = table.Column<decimal>(nullable: false),
                    MatLen = table.Column<decimal>(nullable: false),
                    MatWt = table.Column<decimal>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TPOPL002", x => new { x.ConfmPlanId, x.MatNo });
                    table.ForeignKey(
                        name: "FK_TPOPL002_TPOPL001_ConfmPlanId",
                        column: x => x.ConfmPlanId,
                        principalTable: "TPOPL001",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "TPOPL002");

            migrationBuilder.DropTable(
                name: "TPOPL001");
        }
    }
}
